import { Rule } from "./types";

export const Flake8BugbearRuleList: Rule[] = [
    {
        code: "B002",
        name: "unary-prefix-increment",
        descEn: "Python does not support the unary prefix increment",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B003",
        name: "assignment-to-os-environ",
        descEn: "Assigning to os.environ doesn't clear the environment",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B004",
        name: "unreliable-callable-check",
        descEn: "Using hasattr(x, '__call__') to test if x is callable is unreliable. Use callable(x) for consistent results.",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B005",
        name: "strip-with-multi-characters",
        descEn: "Using .strip() with multi-character strings is misleading the reader",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B006",
        name: "mutable-argument-default",
        descEn: "Do not use mutable data structures for argument defaults",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B007",
        name: "unused-loop-control-variable",
        descEn: "Loop control variable {name} not used within loop body",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B008",
        name: "function-call-in-default-argument",
        descEn: "Do not perform function call {name} in argument defaults",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B009",
        name: "get-attr-with-constant",
        descEn: "Do not call getattr with a constant attribute value. It is not any safer than normal property access.",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B010",
        name: "set-attr-with-constant",
        descEn: "Do not call setattr with a constant attribute value. It is not any safer than normal property access.",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B011",
        name: "assert-false",
        descEn: "Do not assert False (python -O removes these calls), raise AssertionError()",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B012",
        name: "jump-statement-in-finally",
        descEn: "{name} inside finally blocks cause exceptions to be silenced",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B013",
        name: "redundant-tuple-in-exception-handler",
        descEn: "A length-one tuple literal is redundant. Write except {name} instead of except ({name},).",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B014",
        name: "duplicate-handler-exception",
        descEn: "Exception handler with duplicate exception: {name}",
        descCn: "",
        autoFix: true,
    },
    {
        code: "B015",
        name: "useless-comparison",
        descEn: "Pointless comparison. This comparison does nothing but waste CPU instructions. Either prepend assert or remove it.",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B016",
        name: "cannot-raise-literal",
        descEn: "Cannot raise a literal. Did you intend to return it or raise an Exception?",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B017",
        name: "assert-raises-exception",
        descEn: "assertRaises(Exception) should be considered evil",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B018",
        name: "useless-expression",
        descEn: "Found useless expression. Either assign it to a variable or remove it.",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B019",
        name: "cached-instance-method",
        descEn: "Use of functools.lru_cache or functools.cache on methods can lead to memory leaks",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B020",
        name: "loop-variable-overrides-iterator",
        descEn: "Loop control variable {name} overrides iterable it iterates",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B021",
        name: "f-string-docstring",
        descEn: "f-string used as docstring. This will be interpreted by python as a joined string rather than a docstring.",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B022",
        name: "useless-contextlib-suppress",
        descEn: "No arguments passed to contextlib.suppress. No exceptions will be suppressed and therefore this context manager is redundant",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B023",
        name: "function-uses-loop-variable",
        descEn: "Function definition does not bind loop variable {name}",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B024",
        name: "abstract-base-class-without-abstract-method",
        descEn: "{name} is an abstract base class, but it has no abstract methods",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B025",
        name: "duplicate-try-block-exception",
        descEn: "try-except block with duplicate exception {name}",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B026",
        name: "star-arg-unpacking-after-keyword-arg",
        descEn: "Star-arg unpacking after a keyword argument is strongly discouraged",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B027",
        name: "empty-method-without-abstract-decorator",
        descEn: "{name} is an empty method in an abstract base class, but has no abstract decorator",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B028",
        name: "no-explicit-stacklevel",
        descEn: "No explicit stacklevel keyword argument found",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B029",
        name: "except-with-empty-tuple",
        descEn: "Using except (): with an empty tuple does not catch anything; add exceptions to handle",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B030",
        name: "except-with-non-exception-classes",
        descEn: "except handlers should only be exception classes or tuples of exception classes",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B031",
        name: "reuse-of-groupby-generator",
        descEn: "Using the generator returned from itertools.groupby() more than once will do nothing on the second usage",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B032",
        name: "unintentional-type-annotation",
        descEn: "Possible unintentional type annotation (using :). Did you mean to assign (using =)?	",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B904",
        name: "raise-without-from-inside-except",
        descEn: "Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling",
        descCn: "",
        autoFix: false,
    },
    {
        code: "B905",
        name: "zip-without-explicit-strict",
        descEn: "zip() without an explicit strict= parameter",
        descCn: "",
        autoFix: false,
    },
];